<?php
namespace Crm\Table;

use Zend\Db\Sql\Select;

class OrderScoreTable extends AbstractTable
{

    protected $table = 'hy_order_score';

    protected $id = 'order_id';
    

    public function findOne($id)
    {
        $select = new Select(array('os' =>$this->getTable()));
        $select->join(
            array('o' => 'hy_order'),
            'o.order_id = os.order_id',
            array('order_no','user_id') ,
            $select::JOIN_RIGHT
         );
        $select->join(
            array('u' => 'hy_user'),
            'u.user_id = o.user_id',
            array('user_name') ,
            $select::JOIN_LEFT
        );
        
        $select->where(array('o.order_id' => $id));
         
        $rowset = $this->selectWith($select);
        $list = $rowset->toArray();
    
        return $list;
    }
}